//Version 0.0
package testsite4;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;

public class TestSite4 {
    
    // Armor
    Armor bPlate = new Armor("Bronze Platebody", 5);
    Armor iPlate = new Armor("Iron Platebody", 7);
    Armor sPlate = new Armor("Steel Platebody", 10);
    Armor mPlate = new Armor("Mithril Platebody", 15);
    Armor robes = new Armor("Robes", 3);
    Armor tunic = new Armor("Leather Tunic", 4);
    Armor hTunit = new Armor("Hardleather Tunic", 7);
    
    // Weapons
    Weapon bSword = new Weapon("Bronze Sword", 5);
    Weapon iSword = new Weapon("Iron Sword", 7);
    Weapon sSword = new Weapon("Steel Sword", 10);
    Weapon mSword = new Weapon("Mithril Sword", 15);
    Weapon staff = new Weapon("Magic Staff", 10);
    Weapon bow = new Weapon("Bow", 5);
    
    // Enemies
    EnemyUnit goblin = new EnemyUnit("Goblin", 50, 5, 1);
    EnemyUnit wolf = new EnemyUnit("Wolf", 45, 6, 1);
    EnemyUnit rogue = new EnemyUnit("Rogue", 70, 7, 2);
    EnemyUnit soldier = new EnemyUnit("Soldier", 100, 10, 3);
            
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        
        // Misc intitializations
        boolean loop = true;
        int random;
        Player hero = new Player();
        
        System.out.println("What is your name?");
        String charName = input.next();
        System.out.println("Are you a Warrior, Mage, or Archer?");
        String classChoice = input.next().toUpperCase();
        
        // Character classes
        if (classChoice.equals("WARRIOR")) {
            hero = new Player(charName, 125, 15, 10);
        }
        else if (classChoice.equals("MAGE")) {
            hero = new Player(charName, 75, 20, 3);
        }
        else if (classChoice.equals("ARCHER")) {
            hero = new Player(charName, 100, 10, 7);
        }
        
        System.out.println(hero);
        
        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException ex) {
        Logger.getLogger(TestSite4.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        hero.gainGold(5);
            
        System.out.println("You wake up in an inn, with only 5 gold in your "
                + "wallet. What do you do?");
        while(loop) {
                System.out.println("\n\t(1)Go gambling (always a valid option)"
                + "\n\t(2)Look for a bounty");
        int choice = input.nextInt();
        
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException ex) {
        Logger.getLogger(TestSite4.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        switch(choice) {
            case 1:
                random = (int) (Math.random() * 100000000);
                if (random == 0) {
                    System.out.println("You make it big while gambling!\nYou "
                            + "now have 100,000 gold!");
                    hero.gainGold(100000);
                }
                else if (random > 0) {
                    System.out.println("You lost what little money you had.");
                    hero.loseGold(hero.Gold());
                }
                loop = false;
                break;
            case 2:
                System.out.println("You go to look on the bulletin board for a "
                        + "bounty");
                break;
            default:
                System.out.println("Please choose one of the options provided");
        }
        
            }
        
        }

}